<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    // function Person(name, age){
    //   this.name = name
    //   this.age = age
    // }

    // Person.prototype.eat = ()=>{
    //   console.log('我会吃')
    // }

    // let p1 = new Person('张三', 18)
    // let p2 = new Person('李四', 20)
    // console.log(p1, p2)

    // class Person {
    //   constructor(name, age){
    //     this.name = name
    //     this.age = age
    //   }
    //   eat(){
    //     console.log('我会吃')
    //   }
    //   run(){
    //     console.log('我会跑')
    //   }
    // }

    // let p1 = new Person('张三', 18)
    // let p2 = new Person('李四', 20)
    // console.log(p1, p2)


    class Animal {
      constructor(name, gender){
        this.name = name
        this.gender = gender
      }
      run(){
        console.log('我会跑')
      }
    }

    class Dog extends Animal {
      constructor(name, gender, dFriends){
          super(name, gender)
          this.dFriends = dFriends
      }
      eat(){
        console.log('狗狗在吃肉')
      }
    }

    let dog = new Dog('旺财', '公', ['小煤球', '小黑'])
    console.log(dog)
    dog.eat()
    dog.run()
  </script>
</body>
</html>